//
//  RootTabBarViewController.m
//  TravelToHelp
//
//  Created by lanou3g on 15/10/27.
//  Copyright © 2015年 冯贵宾. All rights reserved.
//

#import "RootTabBarViewController.h"

@interface RootTabBarViewController ()

@end

@implementation RootTabBarViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];
    [self.tabBar setTranslucent:YES];
    [self addControllers];
}
- (void)addControllers
{
    [self addChildControllers:[RecommendViewController class] title:@"推荐" imageName:@"RecommendTabBar.png" selectImageName:@"RecommendTabBarS.png"];
    
    [self addChildControllers:[DestinationViewController class] title:@"目的地" imageName:@"DestinationTabBar.png" selectImageName:@"DestinationTabBarS.png"];
    
    [self addChildControllers:[ThemeTableViewController class] title:@"主题游" imageName:@"ThemeTabBar.png" selectImageName:@"ThemeTabBar.png"];
    
    [self addChildControllers:[ScenicViewController class] title:@"景点" imageName:@"ScenicTabBar.png" selectImageName:@"ScenicTabBarS.png"];
    
    [self addChildControllers:[MineViewController class] title:@"我的" imageName:@"MineTabBar.png" selectImageName:@"MineTabBarS.png"];
}

- (void)addChildControllers:(Class)class title:(NSString *)title imageName:(NSString *)imageName selectImageName:(NSString *)selectImageName
{
    UIViewController *oneVC = [[class alloc] init];
    UINavigationController *navC = [[UINavigationController alloc] initWithRootViewController:oneVC];
    navC.tabBarItem.title = title;
    [navC.tabBarItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor blueColor], NSForegroundColorAttributeName, nil] forState:(UIControlStateSelected)];
      [navC.tabBarItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor colorWithRed:0.439 green:0.702 blue:0.973 alpha:1.000], NSForegroundColorAttributeName, nil] forState:(UIControlStateSelected)];
    
    
    [navC.tabBarController.tabBar setTranslucent:NO];

    navC.tabBarItem.image = [UIImage imageNamed:imageName];
    navC.tabBarItem.selectedImage = [UIImage imageNamed:selectImageName];
    self.tabBar.tintColor = [UIColor colorWithRed:0.388 green:0.722 blue:0.965 alpha:1.000];
    [self addChildViewController:navC];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
